#pragma once
class LThread : public LObj
{
protected:

	virtual int	init( void );
	virtual void exit();
public:
	LThread(void);
	virtual ~LThread(void);


	virtual int	threadFun();

	void		stopThread();
	bool		isThreadRun() { return mthreadrun; }
	void		setThreadRun( bool b ){ mthreadrun = b; }
	bool		isThreadStoped() { return mthreadstoped; }
	void		setStoped() { mthreadstoped = true; }

	bool isWork() { return miswork; }
	void stWork( bool b ) { miswork = b; }
protected:
	virtual int work();
	virtual int start();
	virtual void stop();

	virtual int onStart();
	virtual void onStop();
	int workLoop();

	bool miswork;

	HANDLE		mhd;
	bool	isHandle() { return (mhd == INVALID_HANDLE_VALUE ) ? false : true; }

	bool		mthreadrun;
	bool		mthreadstoped;
	void		createThread();

	bool		miscreate;
	DWORD		midthread;
};

